package com.hzy.admin.controller.system;

import com.hzy.admin.framework.controller.BaseController;
import com.hzy.toolkit.NEditorUtils;
import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * neditor 编辑器上传 服务
 *
 * @author HZY
 */
@Api(tags = "编辑器上传控制")
@RequestMapping("/upload")
@RestController
public class UploadController extends BaseController {

    /**
     * 上传文件
     * @param file
     * @return
     * @throws Exception
     */
    @ApiOperation("上传文件")
    @ResponseBody
    @PostMapping("/file")
    public Map<String, Object> files(@RequestParam("file") final MultipartFile file) throws Exception {
        return NEditorUtils.save(file);
    }

}
